#include "../src/xege.h"
#include "../src/event.hpp"
#include <cstdio>
#include <thread>
#include "../include/fmt/format.h"
// #include <conio.h>
// const double PI = 3.14159265357989;

long double operator"" pi(long double x) {
	return x*3.14159265357;
}

long double operator"" pi(unsigned long long x) {
	return static_cast<long double>(x)*3.14159265357;
}
int main (int argc, char **argv) {
// int main (int argc, char **args) {


	int offsetx = 400, offsety = 300;
	int count = 0;

	WINDOW win (800, 600);
	// WINDOW win2 (800, 600);
	// win2.drawCircle(100, 100, 200);
	// win2.update ();
	for (; win; delay_fps (60)) {
		win.setTitle (fmt::format ("the fraps: {}\n", count++))
			.drawLineW (offsetx, offsety,
				offsetx + sin((time(static_cast<time_t*>(nullptr))%60)/60.0*2pi)*200,
				offsety - cos((time(static_cast<time_t*>(nullptr))%60)/60.0*2pi)*200,
				2, XEGERGB (255, 0, 0))
			.drawLineW (offsetx, offsety,
				offsetx + sin((time(static_cast<time_t*>(nullptr))%3600/60)/60.0*2pi)*100,
				offsety - cos((time(static_cast<time_t*>(nullptr))%3600/60)/60.0*2pi)*100,
				4, XEGERGB (0, 255, 0))
			.drawLineW (offsetx, offsety,
				offsetx + sin((time(static_cast<time_t*>(nullptr))%86400/7200)/60.0*2pi)*50,
				offsety - cos((time(static_cast<time_t*>(nullptr))%86400/7200)/60.0*2pi)*50,
				8, XEGERGB (0, 0, 255))
			.drawCircleAA (offsetx, offsety, 220);
		win.update ().clear ();
	}
	return 0;
} 

